#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc , char* argv[])
{
    DIR * dir;
    struct dirent * ptr;
    int i;
    dir = opendir("../../data");
    while((ptr = readdir(dir)) != NULL)
    {
        if(strcmp(".", ptr->d_name) == 0 || 0 == strcmp("..", ptr->d_name) )
        {
            continue;
        }
        //只处理.day文件
        if (strrchr(ptr->d_name, '.') != NULL && strcmp(".day",strrchr(ptr->d_name, '.') ) == 0)
        {   
            //printf("%s",strrchr(ptr->d_name, '.'));
            printf("d_name : %s\n",ptr->d_name);
        } 
    }
    closedir(dir);
    return 0;
}